#ifndef GRID_H
#define GRID_H

#include "D3dUtil.h"

class Grid
{
public:
	Grid();
	Grid(int m, int n, float dx);
	~Grid();

	void DrawGrid(D3DXMATRIX &mView, D3DXMATRIX &mProj, D3DXVECTOR3 &eyePos, float totalTime);
	void OnResetDevice();
	void OnLostDevice();

private:
	IDirect3DVertexBuffer9* mVB;
	IDirect3DIndexBuffer9* mIB;

	void BuildVertexBuffer(int m, int n, float dx);
	void BuildIndexBuffer(int m, int n);

	ID3DXEffect* mFX;
	D3DXHANDLE mhWVP;
	D3DXHANDLE mhTech;
	D3DXHANDLE mhEyePos;
	//D3DXHANDLE mhTime;
	ID3DXBuffer* errors;

	int numVertices;
	int numFaces;
};


#endif